from PyQt4 import QtCore , QtGui , uic
from lib.papyDB import papyDB , tableInfo
from lib.customUI import customUI
from lib.papyDBTable import *
from lib import globalVar
from lib.itemModel import Asset
import os



class taskViewer_UI( QtGui.QDialog , customUI ):
    def __init__(self , parent=None):
        QtGui.QDialog.__init__(self,parent)
        customUI.__init__(self)        
        self.setWindowTitle( "Task List" )
        self.setObjectName('insertItem')
        self.parent = parent
        
    def createTaskTable(self):        
        self.setStyleSheet(self.styleSheet)        
        headerList = ['Name' , 'Status' , 'Start Date' , 'End Date' , 'Final Date' , 'Desc']
        self.task_table = QtGui.QTableView( self )
        self.task_table.setSizePolicy( self.sizePolicy_exex )
        self.task_table.setMinimumHeight(260)
        self.task_table.setGridStyle(QtCore.Qt.DashLine)
        self.task_table.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
        self.task_table.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
        self.task_table.setAlternatingRowColors(True)
        self.task_table.setFont( self.mainFont )

    def setUI(self):
        self.createPSScb()  
        self.search_btn = self.btn('Search')
        self.createTaskTable()
        childGridLayout = QtGui.QGridLayout( self )
        childGridLayout.addLayout( self.PSS_layout , 0, 0, 1, 1 )
        childGridLayout.addWidget( self.search_btn , 1, 0, 1, 2 )
        childGridLayout.addWidget( self.task_table , 2, 0, 1, 2 )
     
        if self.parent != None:
            pos = self.parent.pos()
            self.move( pos.x() +700 , pos.y()+30 )                   
#            self.setGeometry( QtCore.QRect( pos.x() +660, pos.y()+30,260,200 ) )
        else :            
            pos = QtGui.QCursor()            
            self.setGeometry( QtCore.QRect( pos.pos().x(), pos.pos().y()+20,260,200 ) )        
        
    
       
if __name__ == '__main__':
    import sys    
    app = QtGui.QApplication(sys.argv)
    ui = taskViewer_UI()
    ui.setUI()
    ui.show()
    app.exec_()        
    
    
    